package forum;

import com.jfinal.ext.test.ControllerTestCase;
import common.MainConfig;
import model.Student;
import org.junit.Test;

import java.util.List;

public class DBTestCase extends ControllerTestCase<MainConfig>{

    @Test
    public void testStudent(){
        /*Student s = new Student();
        s.setName("杜立文");
        s.save();

       Student s1 = Student.dao.findById(1);
       System.out.println(s1);
       s1.setName("jack");
       s1.update();*/

        /*List<Student> students = Student.dao.find("select * from t_student where name = ?","jack");
        Student s2 = students.get(0);
        s2.delete();*/

        /*List<Student> students = Student.dao.find("select * from t_student where name = ?","jack");
        for (int i = 0; i < students.size(); i++){
            System.out.println(students.get(i));
        }*/

        List<Student> students = Student.dao.find("select * from t_student where name like '%文'");
        for (int i = 0; i < students.size(); i++){
            System.out.println(students.get(i));
        }



    }
}
